package com.tianjin.design.mediator;

public class LeaderMediator extends Mediator{

    private AaaWorker aaaWorker;
    private BbbWorker bbbWorker;

    public void setAaaWorker(AaaWorker aaaWorker) {
        this.aaaWorker = aaaWorker;
    }

    public void setBbbWorker(BbbWorker bbbWorker) {
        this.bbbWorker = bbbWorker;
    }

    @Override
    public void send(String message, Worker worker) {
        if (worker == aaaWorker) {
            // 如果传入的是aaa，也就是开发人员发出信息，则此时设计人员将收到
            bbbWorker.receiver(message);
        } else if (worker == bbbWorker) {
            aaaWorker.receiver(message);
        }
    }
}
